package com.winit.common.base.web;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by wangjian on 16/1/17.
 */
public class BaseController {

    static final Logger logger = LoggerFactory.getLogger(BaseController.class);

    @ExceptionHandler
    public Map<String, Object> exp(HttpServletRequest request, Exception ex) {
        logger.error("系统异常", ex);
        Map<String, Object> rtnMap = new HashMap<String, Object>();
        rtnMap.put("code", "4");
        rtnMap.put("desc", "系统异常,请联系beetle管理员!" + ex.getMessage());
        return rtnMap;
    }
}
